package com.example.developertest;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button openMap = findViewById(R.id.btn_map);
        openMap.setOnClickListener(v -> {
//            Uri location = Uri.parse("geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+California");
//            Intent intent = new Intent(Intent.ACTION_VIEW, location);
//            startActivity(intent);

            Intent intent = new Intent(Intent.ACTION_SEND);

// Create intent to show chooser
            Intent chooser = Intent.createChooser(intent, /* title */ null);

// Try to invoke the intent.
            try {
                startActivity(chooser);
            } catch (ActivityNotFoundException e) {
                // Define what your app should do if no activity can handle the intent.
            }
        });
    }
}